package ar.com.utn.openqsb.main;

import javax.swing.SwingUtilities;

import ar.com.utn.openqsb.commons.util.LanguageUtil;
import ar.com.utn.openqsb.commons.util.Utility;

/**
 * Main Application Launcher.
 * 
 * @author rvega
 * @author aprieto
 */
public class Main {
	/**
	 * @param args
	 *            application parameters.
	 * @throws Exception
	 *             If there is some error initializing the application.
	 */
	public static void main(String[] args) throws Exception {
		// prepare splash screen
		Splash splash = new Splash();
		SwingUtilities.invokeLater(splash);
		Thread.sleep(1000);

		// configure UI
		splash.renderMessage(LanguageUtil
				.getLocalizedMessage("splash.lookandfeel"));
		Utility.configureUI();

		// create main window
		splash.renderMessage(LanguageUtil
				.getLocalizedMessage("splash.openwindow"));
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Launcher launcher = new Launcher();
				launcher.configure();
				launcher.setVisible(true);
			}
		});

		// close splash
		splash.close();

	}
}
